package com.bdqn.rabbitmq;

import com.bdqn.base.Email;
import com.bdqn.service.EmailService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 邮件监听
 *
 * @author LILIBO
 * @since 2021-06-24
 */
@Component
public class DirectListenerEmail {

	/**
	 * 邮件消息队列
	 */
	public static final String QUEUE_NAME_EMAIL = "queue.cloud.email";

	@Resource
	private EmailService emailService;

	@RabbitListener(queues = QUEUE_NAME_EMAIL)
	public void displayMQEmail(Email email) {
		emailService.sendEmail(email);
	}
}
